package memo;

import java.math.BigDecimal;

/**
 * @ClassName Bill
 * @Description TODO
 * @Author leejiliang
 * @DateTime 2021/7/23 16:33
 * @Version 1.0
 */
public class Bill {
	private Long id;
	private String other ;
	private BigDecimal amount;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getOther() {
		return other;
	}

	public void setOther(String other) {
		this.other = other;
	}

	public BigDecimal getAmount() {
		return amount;
	}

	public void setAmount(BigDecimal amount) {
		this.amount = amount;
	}

	public Bill(Long id, String other, BigDecimal amount) {
		this.id = id;
		this.other = other;
		this.amount = amount;
	}


	@Override
	public String toString() {
		return "Bill{" +
				"id=" + id +
				", other='" + other + '\'' +
				", amount=" + amount +
				'}';
	}

	public BillSnapshot getSnapshot() {
		final BillSnapshot billSnapshot = new BillSnapshot(id, other, amount);
		return billSnapshot;
	}

	public void restore(BillSnapshot state) {
		this.id = state.getId();
		this.other = state.getOther();
		this.amount = state.getAmount();
	}
}
